package com.eliza.springboot.v3.actuator.health

import org.springframework.boot.actuate.health.AbstractHealthIndicator
import org.springframework.boot.actuate.health.Health
import org.springframework.stereotype.Component

// 1 实现接口定制健康返回
//@Component
//class Health : HealthIndicator {
//    override fun health(): Health {
//        return Health.down().withDetail("status", 1).build()
//    }
//}

//http://192.168.20.5:8080/actuator/health
// 2 直接实现
@Component
class CustomHealthIndicator : AbstractHealthIndicator() {
    override fun doHealthCheck(builder: Health.Builder) {
        builder.up().withDetails(mapOf("code" to "200", "msg" to "up"))
    }

}